<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('刷量媒体资料列表')" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>平台：</label>
                                <select class="form-control" name="platform" th:with="type=${@dict.getType('work_platform')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>分类：</label>
                                <select class="form-control" name="category" th:with="type=${@dict.getType('work_category')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>是否直营：</label>
                                <select name="isDirect" th:with="type=${@dict.getType('sys_yes_no')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>联系人：</label>
                                <input type="text" name="contacts"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="work:flow:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="work:flow:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="work:flow:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="work:flow:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="work:flow:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
     <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('work:flow:edit')}]];
        var removeFlag = [[${@permission.hasPermi('work:flow:remove')}]];
        var platformDatas = [[${@dict.getType('work_platform')}]];
        var categoryDatas = [[${@dict.getType('work_category')}]];
        var directDatas = [[${@dict.getType('sys_yes_no')}]];
        var prefix = ctx + "work/flow";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importTemplateUrl: prefix + "/importTemplate",
                importUrl: prefix + "/importData",
                modalName: "刷量媒体资料",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'mediaId',
                    title: '媒体ID'
                },
                {
                    field: 'platform',
                    title: '平台',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(platformDatas, value);
                    }
                },
                {
                    field: 'category',
                    title: '分类',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(categoryDatas, value);
                    }
                },
                {
                    field: 'isDirect',
                    title: '是否直营',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(directDatas, value);
                    }
                },
                {
                    field: 'contacts',
                    title: '联系人'
                },

                {
                    field: 'remark',
                    title: '备注'
                }]
            };
            $.table.init(options);
        });
    </script>
     <!-- 导入区域 -->
     <script id="importTpl" type="text/template">
         <form enctype="multipart/form-data" class="mt20 mb10">
             <div class="col-xs-offset-1">
                 <input type="file" id="file" name="file"/>
                 <div class="mt10 pt5">
                     <!--<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据-->
                     &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                         class="fa fa-file-excel-o"></i> 下载模板</a>
                 </div>
                 <font color="red" class="pull-left mt10">
                     提示：仅允许导入“xls”或“xlsx”格式文件！
                 </font>
             </div>
         </form>
     </script>
</body>
</html>